#include "PCArithOpTest.h"
#include <stdio.h>
#include "PCArithOp.h"
#include "common.h"
#include <string.h>
#include "float_def.h"
#include <math.h>

FILE *arith_op_mem_upasm_file, *arith_op_upinc_file, *arith_op_upasm_file;

U31CodeFile arith_op_code_file;

Reg32 arith_op_f_a[] = {
    f_qnan,
    f_snan,
    f_infinity_n,
    f_infinity,
    f_0,
    f_0_n,
    f_max_normal,
    f_max_normal_n,
    f_min_normal,
    f_min_normal_n,
    f_max_subnormal,
    f_max_subnormal_n,
    f_min_subnormal,
    f_min_subnormal_n,
    f_1,
    f_1_n,
    f_acc_1,
    f_acc_1_n,
    f_pi,
    f_pi_n,
    f_sqrt2,
    f_sqrt2_n,
    f_sqrt3,
    f_sqrt3_n,
    f_e,
    f_e_n,
};
Reg32 arith_op_f_b[] = {
    f_qnan,
    f_snan,
    f_infinity_n,
    f_infinity,
    f_0,
    f_0_n,
    f_max_normal,
    f_max_normal_n,
    f_min_normal,
    f_min_normal_n,
    f_max_subnormal,
    f_max_subnormal_n,
    f_min_subnormal,
    f_min_subnormal_n,
    f_1,
    f_1_n,
    f_acc_1,
    f_acc_1_n,
    f_pi,
    f_pi_n,
    f_sqrt2,
    f_sqrt2_n,
    f_sqrt3,
    f_sqrt3_n,
    f_e,
    f_e_n,
};
void test_divs64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_divs64);
}

void test_comp32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_comp32);
}

void test_abs64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_abs64);
}

void test_signed()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_signed);
}

void test_xor()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_xor);
}

void test_xor64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_xor64);
}

void test_and64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_and64);
}

void test_or64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_or64);
}

void test_min64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_min64);
}

void test_max64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_max64);
}

void test_bit_clr()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[32] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_bit_clr);
}

void test_loop_sr32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg128 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_loop_sr32);
}

void test_loop_sr16()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg128 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_loop_sr16);
}

void test_loop_sr8()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg128 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_loop_sr8);
}

void test_loop_sl32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg128 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_loop_sl32);
}

void test_loop_sl16()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg128 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_loop_sl16);
}

void test_loop_sl8()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg128 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_loop_sl8);
}

void test_rd8()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[16] = {0};
    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_rd8);
}

void test_rd16l()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[8] = {0};
    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_rd16l);
}

void test_rd16h()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[8] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_rd16h);
}

void test_rd32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[4] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_rd32);
}

void test_rd64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[2] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    Reg128 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_rd64);
}

void test_sl64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[63] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = -31;
    gen_array(b, b_size, start, 1);

    Reg64 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_sl64);
}

void test_srs64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[63] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = -31;
    gen_array(b, b_size, start, 1);

    Reg64 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_srs64);
}

void test_sl32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[32] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_sl32);
}

void test_fabs()
{
    Reg32 opt1 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, opt1, dst, arith_op_fabs);
}

void test_fmin()
{
    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_fmin);
}

void test_fmax()
{
    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_fmax);
}

void test_f32toi64()
{
    Reg32 b[64] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, b, opt1, opt2, dst, arith_op_f32toi64);
}

void test_i8tof32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[8] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_i8tof32);
}

void test_fmuladd()
{
    Reg32 f_c[] = {
        f_qnan,
        f_snan,
        f_infinity_n,
        f_infinity,
        f_0,
        f_0_n,
    };

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_INIT_DST_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, arith_op_f_b, opt1, opt2, dst, arith_op_fmuladd);
}
void test_fmul()
{
    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_fmul);
}
void test_fmulsub()
{
    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_2_OP_INIT_DST_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, arith_op_f_b, opt1, opt2, dst, arith_op_fmulsub);
}

void test_fadd()
{
    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_fadd);
}
void test_fsub()
{
    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_fsub);
}

void test_flog2()
{
    Reg32 opt1 = {0};
    Reg32 dst = {0};
    bool clr_dst = true; // 是否每次都需要清零

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, opt1, dst, arith_op_flog2);
}

void test_exp2_frac32()
{
    float f_a[] = {0.000081, -16.25, -31, -30.512, -41.563587, 14.9999, -13.40625, -15.25, -17, -2.7182817459106445, -1.7320507764816284, -1.4142135381698608, -2.5, -2, -1.833333333, -1, -0.833333333, -0.75, -0.666666667, -0.5, -0.333333333, -0.25, -0.166666667, 0, 0.166666667, 0.25, 0.333333333, 0.5, 0.666666667, 0.75, 0.833333333, 1, 1.833333333, 2, 2.5, 2.7182817459106445, 1.7320507764816284, 1.4142135381698608};
    size_t size_f_a = sizeof(f_a) / sizeof(float);
    Reg32 a[size_f_a] = {0};

    for (size_t i = 0; i < size_f_a; i++)
    {
        a[i].sword = floor(f_a[i] * pow(2, 24)); // m8p24
    }

    // size_t max_size = 500;
    // float f_a[max_size] = {0};
    // Reg32 a[2 * max_size] = {0};

    // random_gen(f_a, max_size);
    // // print_array(f_a, max_size, "%f");
    // for (size_t i = 0; i < max_size; i++)
    // {
    //     a[2 * i].sword = floor(f_a[i] * pow(2, 24));      // m8p24
    //     a[2 * i + 1].sword = floor(-f_a[i] * pow(2, 24)); // m8p24
    // }

    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_exp2_frac32);
}

void test_mulc_32o()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_mulc_32o);
}

void test_mulc32_16()
{
    // Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    // Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 a[] = {0x00000001, 0x00000010};
    Reg32 b[] = {0x00010000};

    Reg64 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_mulc32_16);
}

void test_mulc32_32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_mulc32_32);
}

void test_conj32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_conj32);
}

void test_add_c32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_add_c32);
}

void test_sub_c32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_sub_c32);
}

void test_fmulc_conj()
{
    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_fmulc_conj);
}

void test_rpc16()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0, 1};

    Reg64 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_rpc16);
}

void test_frelu()
{
    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, opt1, dst, arith_op_frelu);
}
void test_fleaky()
{
    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, opt1, dst, arith_op_fleaky);
}

void test_fdiv()
{
    Reg32 a[1], b[1];
    a[0].word = 0x3CB4361D;
    b[0].word = 0x3FCC27F2;
    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};
    // GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_fdiv);
    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_fdiv);
}
void test_comp16()
{
    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_comp16);
}

void test_slc()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[31] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = -15;
    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_slc);
}

void test_src()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[31] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = -15;
    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_src);
}

void test_conj()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_conj);
}

void test_add_c()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_add_c);
}
void test_sub_c()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_sub_c);
}

void test_fadd_c()
{
    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};
    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_fadd_c);
}
void test_fsub_c()
{
    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};
    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_fsub_c);
}

void test_fconj()
{
    Reg64 opt1 = {0};
    Reg64 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, opt1, dst, arith_op_fconj);
}

void test_add()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_add);
}
void test_sub()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_sub);
}
void test_add64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_add64);
}
void test_sub64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_sub64);
}

void test_fneg()
{
    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, opt1, dst, arith_op_fneg);
}

void test_abs()
{
    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, opt1, dst, arith_op_abs);
}
void test_and()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_and);
}

void test_or()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_or);
}
void test_cvt32_64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[3] = {0, 1, 2};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_cvt32_64);
}

void test_min()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_min);
}
void test_max()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_max);
}
void test_bit_set()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[32] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_bit_set);
}

void test_sl()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[63] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = -31;
    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_sl);
}

void test_slp()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[63] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = -31;
    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_slp);
}

void test_sru()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[63] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = -31;
    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_sru);
}
void test_srs()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[63] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = -31;
    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_srs);
}

void test_divs32f()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_divs32f);
}

void test_divs32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_divs32);
}
void test_divs64_32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_divs64_32);
}

void test_sqrt()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_sqrt);
}

void test_sqrtf()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_sqrtf);
}

void test_fsqrt()
{
    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, opt1, dst, arith_op_fsqrt);
}

void test_muls16()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_muls16);
}
void test_muls16f()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_muls16f);
}

void test_muls32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_muls32);
}
void test_muls32f()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_muls32f);
}
void test_muls32_64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_muls32_64);
}
void test_muls64_32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_muls64_32);
}

void test_muls64_32f()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg32 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_muls64_32f);
}

void test_mulc()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_mulc);
}

void test_fmulc()
{
    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, arith_op_f_b, opt1, opt2, dst, arith_op_fmulc);
}

void test_cvt64_32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg64 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_cvt64_32);
}

void test_i32tof32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[32] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_i32tof32);
}

void test_f32toi32()
{
    Reg32 b[32] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = 0;
    gen_array(b, b_size, start, 1);

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, b, opt1, opt2, dst, arith_op_f32toi32);
}

void test_fsl()
{
    Reg32 b[63] = {0};

    size_t b_size = sizeof(b) / sizeof(Reg32);
    Reg32 start = {0};
    start.sword = -31;
    gen_array(b, b_size, start, 1);

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, arith_op_f_a, b, opt1, opt2, dst, arith_op_fsl);
}

void test_cvt32_16()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_cvt32_16);
}
void test_atk_rls()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    S32 reg_r38 = 0xFFFEFFFF;

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    const char *functionName = __func__;
    char arr[80] = {0};
    strncpy(arr, functionName + 5, sizeof(arr) - 1);
    arr[sizeof(arr) - 1] = '\0';
    size_t a_size = sizeof(a) / sizeof(U32);
    size_t b_size = sizeof(b) / sizeof(U32);
    size_t opt1_size = sizeof(opt1) / sizeof(U32);
    size_t opt2_size = sizeof(opt2) / sizeof(U32);
    size_t dst_size = sizeof(dst) / sizeof(U32);
    size_t res_size = a_size * b_size * dst_size;
    Reg32 res[res_size] = {0};
    size_t index = 0;
    for (size_t i = 0; i < a_size; i++)
    {
        set_opt((void *)&opt1, opt1_size, a, a_size, i);
        for (size_t j = 0; j < b_size; j++)
        {
            memset((char *)&dst, 0x00, sizeof(dst));
            set_opt((void *)&opt2, opt2_size, b, b_size, j);
            arith_op_atk_rls(&dst, &opt1, &opt2, reg_r38);
            set_result((Reg32 *)&res, res_size, &index, (void *)&dst, dst_size);
        }
    }
    gen_memupasm_input_data_lable(arith_op_mem_upasm_file, arr, 1, a, a_size, opt1_size);
    gen_memupasm_input_data_lable(arith_op_mem_upasm_file, arr, 2, b, b_size, opt2_size);
    gen_mem_upasm_result_data_lable(arith_op_mem_upasm_file, arr, res, res_size);
    gen_upinc_input_data_lable(arith_op_upinc_file, arr, 1);
    gen_upinc_input_data_lable(arith_op_upinc_file, arr, 2);
    gen_upinc_result_data_lable(arith_op_upinc_file, arr);
    gen_upasm_2_op_atk_rls_code(arith_op_upasm_file, arr, reg_r38, opt1_size, a_size, opt2_size, b_size, dst_size);
}
void test_muls64_64()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[] = {0x7fffffff, 0x00000000,
                 0x00000000, 0x00000000,
                 0x80000000, 0xFFFFFFFF,
                 0x5a5a5a5a, 0x00000000,
                 0xa5a5a5a5, 0xFFFFFFFF};

    Reg64 opt1 = {0};
    Reg64 opt2 = {0};
    Reg64 dst = {0};

    const char *functionName = __func__;
    char arr[80] = {0};
    strncpy(arr, functionName + 5, sizeof(arr) - 1);
    arr[sizeof(arr) - 1] = '\0';
    size_t a_size = sizeof(a) / sizeof(U32);
    size_t b_size = sizeof(b) / sizeof(U32);
    size_t opt1_size = sizeof(opt1) / sizeof(U32);
    size_t opt2_size = sizeof(opt2) / sizeof(U32);
    size_t dst_size = sizeof(dst) / sizeof(U32);
    size_t res_size = a_size * b_size / opt2_size * dst_size;
    Reg32 res[res_size] = {0};
    size_t index = 0;
    for (size_t i = 0; i < a_size; i++)
    {
        set_opt((void *)&opt1, opt1_size, a, a_size, i);
        for (size_t j = 0; j < b_size;)
        {
            memset((char *)&dst, 0x00, sizeof(dst));
            opt2.sword[0] = b[j].sword;
            opt2.sword[1] = b[j + 1].sword;
            j += 2;
            arith_op_muls64_64(&dst, &opt1, &opt2);
            set_result((Reg32 *)&res, res_size, &index, (void *)&dst, dst_size);
        }
    }
    U8 res_idx = 1;
    gen_memupasm_input_data_lable(arith_op_mem_upasm_file, arr, 1, a, a_size, opt1_size);
    gen_memupasm_input_data_lable(arith_op_mem_upasm_file, arr, 2, b, b_size, opt2_size);
    gen_mem_upasm_result_data_lable(arith_op_mem_upasm_file, arr, res, res_size);
    gen_upinc_input_data_lable(arith_op_upinc_file, arr, 1);
    gen_upinc_input_data_lable(arith_op_upinc_file, arr, 2);
    gen_upinc_result_data_lable(arith_op_upinc_file, arr);
    gen_upasm_2_op_muls64_64_code(arith_op_upasm_file, arr, opt1_size, a_size, 1, 1, opt2_size, b_size, opt2_size, 2, dst_size);

    // 交换
    size_t res1_size = a_size * b_size / opt1_size * dst_size;
    Reg32 res1[res1_size] = {0};
    index = 0;
    for (size_t i = 0; i < b_size;)
    {
        opt1.sword[0] = b[i].sword;
        opt1.sword[1] = b[i + 1].sword;
        i += 2;
        for (size_t j = 0; j < a_size; j++)
        {
            memset((char *)&dst, 0x00, sizeof(dst));
            set_opt((void *)&opt2, opt2_size, a, a_size, j);
            arith_op_muls64_64(&dst, &opt1, &opt2);
            set_result((Reg32 *)&res1, res1_size, &index, (void *)&dst, dst_size);
        }
    }
    res_idx = 3;
    gen_memupasm_input_data_lable(arith_op_mem_upasm_file, arr, 3, b, b_size, opt1_size);
    gen_memupasm_input_data_lable(arith_op_mem_upasm_file, arr, 4, a, a_size, opt2_size);
    gen_mem_upasm_result_data_lable(arith_op_mem_upasm_file, arr, res1, res1_size, res_idx);
    gen_upinc_input_data_lable(arith_op_upinc_file, arr, 3);
    gen_upinc_input_data_lable(arith_op_upinc_file, arr, 4);
    gen_upinc_result_data_lable(arith_op_upinc_file, arr, res_idx);
    gen_upasm_2_op_muls64_64_code(arith_op_upasm_file, arr, opt1_size, b_size, opt1_size, 3, opt2_size, a_size, 1, 4, dst_size, res_idx);
}
void test_relu()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[1] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    Reg32 start;
    start.word = 14;

    size_t b_size = sizeof(b) / sizeof(U32);

    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_relu);
}
void test_leaky()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[1] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    Reg32 start;
    start.word = 15;

    size_t b_size = sizeof(b) / sizeof(U32);

    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_leaky);
}
void test_linear()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};
    Reg32 b[1] = {0};

    Reg32 opt1 = {0};
    Reg32 opt2 = {0};
    Reg32 dst = {0};

    Reg32 start;
    start.word = 15;

    size_t b_size = sizeof(b) / sizeof(U32);

    gen_array(b, b_size, start, 1);

    GENERATE_2_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, b, opt1, opt2, dst, arith_op_linear);
}

void test_sin()
{
#if 0
    float f_a[] = {-2.7182817459106445, -1.7320507764816284, -1.4142135381698608, -2.5, -2, -1.833333333, -1, -0.833333333, -0.75, -0.666666667, -0.5, -0.333333333, -0.25, -0.166666667, 0, 0.166666667, 0.25, 0.333333333, 0.5, 0.666666667, 0.75, 0.833333333, 1, 1.833333333, 2, 2.5, -2.7182817459106445, -1.7320507764816284, -1.4142135381698608};

    size_t size_f_a = sizeof(f_a) / sizeof(float);
    Reg32 a[size_f_a] = {0};

    for (size_t i = 0; i < size_f_a; i++)
    {
        // 归到[-1, 1]
        float norm = f_a[i];
        while (norm > 1)
            norm -= 2;
        while (norm < -1)
            norm += 2;
        a[i].sword = floor(norm * pow(2, 24)); // m8024
    }
#else
    size_t max_size = 500;
    float f_a[max_size] = {0};
    Reg32 a[2 * max_size] = {0};

    random_gen(f_a, max_size);
    // print_array(f_a, max_size, "%f");
    for (size_t i = 0; i < max_size; i++)
    {
        // 归到[-1, 1]
        float norm = f_a[i];
        while (norm > 1)
            norm -= 2;
        while (norm < -1)
            norm += 2;
        a[2 * i].sword = floor(norm * pow(2, 24));      // m8p24
        a[2 * i + 1].sword = floor(-norm * pow(2, 24)); // m8p24
    }
#endif
    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_sin);
}

void test_cos()
{
#if 0
    // float f_a[] = {-2.7182817459106445, -1.7320507764816284, -1.4142135381698608, -2.5, -2, -1.833333333, -1, -0.833333333, -0.75, -0.666666667, -0.5, -0.333333333, -0.25, -0.166666667, 0, 0.166666667, 0.25, 0.333333333, 0.5, 0.666666667, 0.75, 0.833333333, 1, 1.833333333, 2, 2.5, -2.7182817459106445, -1.7320507764816284, -1.4142135381698608};

    // size_t size_f_a = sizeof(f_a) / sizeof(float);
    // Reg32 a[size_f_a] = {0};

    // for (size_t i = 0; i < size_f_a; i++)
    // {
    //     // 归到[-1, 1]
    //     float norm = f_a[i];
    //     while (norm > 1)
    //         norm -= 2;
    //     while (norm < -1)
    //         norm += 2;
    //     a[i].sword = floor(norm * pow(2, 24)); // m8024
    // }
#else
    size_t max_size = 500;
    float f_a[max_size] = {0};
    Reg32 a[2 * max_size] = {0};

    random_gen(f_a, max_size);
    // print_array(f_a, max_size, "%f");
    for (size_t i = 0; i < max_size; i++)
    {
        // 归到[-1, 1]
        float norm = f_a[i];
        while (norm > 1)
            norm -= 2;
        while (norm < -1)
            norm += 2;
        a[2 * i].sword = floor(norm * pow(2, 24));      // m8p24
        a[2 * i + 1].sword = floor(-norm * pow(2, 24)); // m8p24
    }
#endif
    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_cos);
}
void test_fsin()
{
#if 0
    // float f_a[] = {1.6777216e+07, -1.6777216e+07, 8388608.0, -8388608.0, -1.4142135381698608, -2.5, -2, -1.833333333, -1, -0.833333333, -0.75, -0.666666667, -0.5, -0.333333333, -0.25, -0.166666667, 0, 0.166666667, 0.25, 0.333333333, 0.5, 0.666666667, 0.75, 0.833333333, 1, 1.833333333, 2, 2.5, -2.7182817459106445, -1.7320507764816284, -1.4142135381698608};
    // size_t size_f_a = sizeof(f_a) / sizeof(float);

    // Reg32 a[size_f_a] = {0};

    // for (size_t i = 0; i < size_f_a; i++)
    // {
    //     a[i].f = f_a[i];
    // }
#else
    size_t max_size = 500;
    float f_a[max_size] = {0};
    Reg32 a[2 * max_size] = {0};

    random_gen(f_a, max_size);
    // print_array(f_a, max_size, "%f");
    for (size_t i = 0; i < max_size; i++)
    {
        a[2 * i].f = f_a[i];
        a[2 * i + 1].f = -f_a[i];
    }
#endif
    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_fsin);
}
void test_fcos()
{
#if 0
    float f_a[] = {1.6777216e+07, -1.6777216e+07, 8388608.0, -8388608.0, -1.4142135381698608, -2.5, -2, -1.833333333, -1, -0.833333333, -0.75, -0.666666667, -0.5, -0.333333333, -0.25, -0.166666667, 0, 0.166666667, 0.25, 0.333333333, 0.5, 0.666666667, 0.75, 0.833333333, 1, 1.833333333, 2, 2.5, -2.7182817459106445, -1.7320507764816284, -1.4142135381698608};
    size_t size_f_a = sizeof(f_a) / sizeof(float);

    Reg32 a[size_f_a] = {0};

    for (size_t i = 0; i < size_f_a; i++)
    {
        a[i].f = f_a[i];
    }
#else
    size_t max_size = 500;
    float f_a[max_size] = {0};
    Reg32 a[2 * max_size] = {0};

    random_gen(f_a, max_size);
    // print_array(f_a, max_size, "%f");
    for (size_t i = 0; i < max_size; i++)
    {
        a[2 * i].f = f_a[i];
        a[2 * i + 1].f = -f_a[i];
    }
#endif
    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_fcos);
}

void test_log2_m16p16()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_log2_m16p16);
}

void test_log2_frac32()
{
    Reg32 a[] = {0x7fffffff, 0x80000000, 0x00000000, 0x5a5a5a5a, 0xa5a5a5a5};

    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_log2_frac32);
}

void test_exp2_m16p16()
{
#if 0
    float f_a[] = {0.000081, -16, -16.25, -15.65, 16, 17.23, 15.47, -41.563587, 14.9999, -13.40625, -15.25, -17, -2.7182817459106445, -1.7320507764816284, -1.4142135381698608, -2.5, -2, -1.833333333, -1, -0.833333333, -0.75, -0.666666667, -0.5, -0.333333333, -0.25, -0.166666667, 0, 0.166666667, 0.25, 0.333333333, 0.5, 0.666666667, 0.75, 0.833333333, 1, 1.833333333, 2, 2.5, 2.7182817459106445, 1.7320507764816284, 1.4142135381698608};

    size_t size_f_a = sizeof(f_a) / sizeof(float);

    Reg32 a[size_f_a] = {0};

    for (size_t i = 0; i < size_f_a; i++)
    {
        a[i].sword = floor(f_a[i] * pow(2, 24)); // m8p24
    }
#else
    size_t max_size = 500;
    float f_a[max_size] = {0};
    Reg32 a[2 * max_size] = {0};

    random_gen(f_a, max_size, 255);
    // print_array(f_a, max_size, "%f");
    for (size_t i = 0; i < max_size; i++)
    {
        a[2 * i].sword = floor(f_a[i] * pow(2, 24));      // m8p24
        a[2 * i + 1].sword = floor(-f_a[i] * pow(2, 24)); // m8p24
    }
#endif
    Reg32 opt1 = {0};
    Reg32 dst = {0};

    GENERATE_1_OP_CODE(arith_op_mem_upasm_file, arith_op_upinc_file, arith_op_upasm_file, a, opt1, dst, arith_op_exp2_m16p16);
}

void pc_arith_op_instruction_test()
{
    creat_u31_project("u31_arith_op_test1", arith_op_code_file);

    arith_op_mem_upasm_file = arith_op_code_file.mem_upasm_file;
    arith_op_upinc_file = arith_op_code_file.upinc_file;
    arith_op_upasm_file = arith_op_code_file.upasm_file;
    gen_mem_upasm_diff_buffer_lable(arith_op_mem_upasm_file, 16);
    gen_upinc_diff_buffer_lable(arith_op_upinc_file);
    gen_upasm_head_code(arith_op_upasm_file);

    // test_divs64();
    // test_comp32();
    // test_signed();
    // test_xor();
    // test_xor64();
    // test_and64();
    // test_or64();
    // test_min64();
    // test_max64();
    // test_loop_sr32();
    // test_loop_sr16();
    // test_loop_sr8();
    // test_loop_sl32();
    // test_loop_sl16();
    // test_loop_sl8();
    // test_rd8();
    // test_rd16l();
    // test_rd16h();
    // test_rd32();
    // test_rd64();
    // test_sl32();
    // test_fsl();
    // test_sl64();
    // test_srs64();
    // test_fabs();
    // test_fmin();
    // test_fmax();
    // test_f32toi64();
    // test_i8tof32();
    // test_mulc32_16();
    // test_mulc32_32();
    // test_comp16();
    // test_cvt32_16();
    // test_atk_rls();
    // test_muls64_64();
    // test_slc();
    // test_src();
    // test_conj();
    // test_add_c();
    // test_sub_c();
    // test_add();
    // test_sub();
    // test_add64();
    // test_sub64();
    // test_fneg();
    // test_abs();
    // test_and();
    // test_or();
    // test_min();
    // test_max();
    // test_sl();
    // test_slp();
    // test_sru();
    // test_srs();
    // test_cvt64_32();
    // test_i32tof32();
    // test_f32toi32();
    // test_relu();
    // test_linear();
    // test_leaky();
    // test_conj32();
    // test_add_c32();
    // test_sub_c32();
    // test_divs32f();
    // test_divs32();
    // test_divs64_32();
    // test_sin();
    // test_cos();
    // test_exp2_m16p16();
    // test_sqrt();
    // test_sqrtf();
    // test_mulc_32o();
    // test_abs64();
    // test_muls16();
    // test_muls16f();
    // test_muls32();
    // test_muls32f();
    // test_muls32_64();
    // test_muls64_32();
    // test_muls64_32f();
    // test_mulc();
    // test_rpc16();    // 立即数 生成的U31代码,需要修改立即数 0 1
    // test_cvt32_64(); // 立即数 生成的U31代码,需要修改立即数 0 1 2
    // test_bit_clr();  // 立即数 生成的U31代码,需要修改立即数 0~31
    // test_bit_set();  // 立即数 生成的U31代码,需要修改立即数 0~31

    // test_fsqrt();
    // test_fmulc();
    // test_fmuladd(); 
    // test_fmulsub();
    // test_exp2_frac32();
    // test_fsin();
    // test_fcos();
    // test_fmul();
    // test_fadd();
    // test_fsub();
    // test_fdiv();
    test_fmulc_conj(); 
    // test_frelu();
    // test_fleaky();
    // test_fadd_c();
    // test_fsub_c();
    // test_fconj();

    // test_flog2();   // not pass
    // test_log2_m16p16();  // not pass
    // test_log2_frac32();  // not pass
    gen_upasm_tail_code(arith_op_upasm_file);

    close_project(arith_op_code_file);
}
